package com.ehualu.msg.util;

import java.util.concurrent.TimeUnit;

import com.google.common.util.concurrent.RateLimiter;

import net.jodah.expiringmap.ExpirationPolicy;
import net.jodah.expiringmap.ExpiringMap;

public class TimesLimitMapUtil {

	private static ExpiringMap<String, RateLimiter> expiringMap;

	public static ExpiringMap<String, RateLimiter> getInstance() {
		if (expiringMap == null) {
			expiringMap = ExpiringMap.builder()
					.expiration(12, TimeUnit.HOURS)
					.expirationPolicy(ExpirationPolicy.ACCESSED).build();
		}
		return expiringMap;
	}
	
	
}
